package com.fcgzs.item.controller;

import com.fcgzs.entity.Result;
import com.fcgzs.entity.StatusCode;
import com.fcgzs.item.service.PageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Auther: ljj
 * @Description:
 */
@RestController
@RequestMapping("/page")
public class PageController {

    @Autowired
    private PageService pageService;

    @GetMapping("/createItemHtml/{goodsId}")
    public Result createItemHtml(@PathVariable(name = "goodsId") Long goodsId){
        try {
            pageService.createItemHtml(goodsId);
            return new Result();
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, StatusCode.ERROR,"生成失败");
        }
    }
}
